//
//  BZ_GHS_CatogryViewController.m
//  penzer
//
//  Created by caiyc on 2018/11/16.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "BZ_GHS_CatogryViewController.h"
#import "BZMineRegualTableModel.h"
#import "BZMineRegularItemTableViewCell.h"
@interface BZ_GHS_CatogryViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,copy)NSMutableArray *table_Data;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIButton *Add_Btn;

@end

@implementation BZ_GHS_CatogryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"品类";
    [self setUpRightButtonItem:2 style:BZButtonImageStyleLeft Image:@"编辑" title:@"编辑" target:@selector(edit) width:60 titleColor:[UIColor whiteColor] titleFont:14];
    [self setAdd_BtnStyle];
    [self SetupTabView];
    [self configData];
    // Do any additional setup after loading the view from its nib.
}

-(void)edit{
    
}

-(void)configData
{
    NSArray *subtitle = @[@"APPle 官方旗舰店",@"电子产品行业",@"手机",@"环球中心2121",@"15912146207@163.com",@"15912146207"];
    NSArray *titles = @[@"企业名称",@"业态",@"品类",@"地址管理",@"邮箱",@"电话"];
    for(int i =0;i<titles.count;i++){
        BZMineRegualTableModel*model = [BZMineRegualTableModel new];
        model.title =@"品类";
        model.canClick=0;
        model.titleColor = RGBA(51, 51, 51,0.5);
        model.imageStr = @"";
        model.sub_title = subtitle[i];
        [self.table_Data addObject:model];
    }
    [self.tableView reloadData];
}


-(void)SetupTabView
{
    
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([BZMineRegularItemTableViewCell class]) bundle:nil]  forCellReuseIdentifier:NSStringFromClass([BZMineRegularItemTableViewCell class])];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.estimatedRowHeight = 200;
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}


-(void)setAdd_BtnStyle{
    self.Add_Btn.layer.cornerRadius = 25;
    self.Add_Btn.layer.masksToBounds = 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.table_Data.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //BZMineRegularItemTableViewCell
    BZMineRegularItemTableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:NSStringFromClass([BZMineRegularItemTableViewCell class])];
    [cell setModel:self.table_Data[indexPath.row]];
    return cell;
    
}


#pragma mark--getter&&setter
-(NSMutableArray *)table_Data{
    if(!_table_Data){
        _table_Data = [NSMutableArray array];
    }
    return _table_Data;
}

@end
